/** 
 * 1.shallowReactive ,shallowRef
 * 2.shallowReadonly
 * 3.reactive,ref
 * 4.readonly
 */


function shallowReadonly(obj) {
  return new Proxy(obj, {
    get(obj, key) {
      return obj[key]
    },
    set(obj, key, val) {
      // obj[key] = val;
      // console.log("更新ui界面")
      console.warn("message:" + ` ${key} ` + "是只读的不能赋值")
      return true
    }
  })
}
let obj = {
  a: "a",
  gf: {
    b: "b",
    f: {
      c: "c",
      s: {
        d: "d"
      }
    }
  }
}
let state = shallowReadonly(obj)
state.a = 1;
state.gf.b = 2;
state.gf.f.c = 3;
state.gf.f.s.d = 4;